<template>
	<el-config-provider :size="getGlobalComponentSize" :locale="zhCn">
		<router-view />
	</el-config-provider>
</template>

<script setup name="app">
import { useRoute } from 'vue-router'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import Tools from '@/utils/tools'
import { useThemeConfig } from '@/stores/themeConfig'
import { waterMark } from '@meta/utils'
// 定义变量内容
const route = useRoute()
const storesThemeConfig = useThemeConfig()
const { themeConfig } = storeToRefs(storesThemeConfig)

// 获取全局组件大小
const getGlobalComponentSize = computed(() => {
	return Tools.globalComponentSize()
})
const getThemeConfig = computed(() => {
	return themeConfig.value
})

onMounted(() => {
	// 是否开启水印
	getThemeConfig.value.isWartermark ? waterMark.set(getThemeConfig.value.wartermarkText) : waterMark.del()
})
// 监听路由的变化，设置网站标题
watch(
	() => route.path,
	() => {
		Tools.useTitle()
	},
	{
		deep: true,
	}
)
</script>
